#[root@localhost script]# cat start_ovn_controller.sh 
#/usr/share/ovn/scripts/ovn-ctl start_controller
#[root@localhost script]# cat start_ovn_northd.sh 
#/usr/share/ovn/scripts/ovn-ctl start_northd
#[root@localhost script]# cat start_ovs.sh 
#/usr/share/openvswitch/scripts/ovs-ctl start --system-id=random

#ovn控制器执行
#start_ovs.sh && start_ovn_northd.sh && start_ovn_controller.sh


/usr/share/ovn/scripts/ovn-ctl start_controller
/usr/share/ovn/scripts/ovn-ctl start_northd
/usr/share/openvswitch/scripts/ovs-ctl start --system-id=random


MY_IP=192.168.188.187
ovn-nbctl set-connection ptcp:6641:0.0.0.0
ovn-sbctl set-connection ptcp:6642:0.0.0.0

ovs-vsctl add-br br-int -- set Bridge br-int fail-mode=secure
ovs-vsctl set open . external-ids:ovn-remote=tcp:0.0.0.0:6642
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
ovs-vsctl set open . external-ids:ovn-encap-ip=$MY_IP
LOCAL_CHASSIS=`ovn-sbctl show | grep Chassis | awk '{print $2}' | sed 's/"//g' | awk 'NR==1{print}'`
ovn-nbctl create Logical_Router name=router options:chassis=d87aafca-8c3e-4681-a9c1-02db4715d0f9
ovn-nbctl ls-add lswitch1
ovn-nbctl ls-add lswitch2

ovn-nbctl lrp-add router lr-ls1 52:54:00:c1:68:50 10.0.0.1/24
ovn-nbctl lrp-add router lr-ls2 52:54:00:c1:68:60 10.1.0.1/24

ovn-nbctl lsp-add lswitch1 ls1-lr1
ovn-nbctl lsp-set-type ls1-lr1 router
ovn-nbctl lsp-set-addresses ls1-lr1 52:54:00:c1:68:50
ovn-nbctl lsp-set-options ls1-lr1 router-port=lr-ls1


ovn-nbctl lsp-add lswitch2 ls2-lr1
ovn-nbctl lsp-set-type ls2-lr1 router
ovn-nbctl lsp-set-addresses ls2-lr1 52:54:00:c1:68:60
ovn-nbctl lsp-set-options ls2-lr1 router-port=lr-ls2

ovn-nbctl lsp-add lswitch1 ls1-vm1
ovn-nbctl lsp-set-addresses ls1-vm1 "02:ac:10:ff:01:30 10.0.0.10"
ovn-nbctl lsp-set-port-security ls1-vm1 "02:ac:10:ff:01:30 10.0.0.10"

ovn-nbctl lsp-add lswitch2 ls2-vm2
ovn-nbctl lsp-set-addresses ls2-vm2 "02:ac:10:ff:01:31 10.1.0.20"
ovn-nbctl lsp-set-port-security ls2-vm2 "02:ac:10:ff:01:31 10.1.0.20"

